<!DOCTYPE html>
<html lang="zh-cmn-Hans">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>微信JS-SDK测试</title>

    <!-- 微信UI库 -->
    <link rel="stylesheet" href="libs/weui/weui.css">

    <!-- 微信JS库 -->
    <script type="text/javascript" src="libs/weui.js/weui.js"></script>
    <!-- jQuery -->
    <script type="text/javascript" src="libs/jquery/jquery-2.2.3.min.js"></script>
    <!-- 微信JS-SDK -->
    <script type="text/javascript" src="libs/js-sdk/jweixin-1.2.0.js"></script>


</head>
<body>
    <script type="text/javascript">
        $(function() {
            $.ajax({
                type: 'POST',
                url: 'http://yhaoquan.imwork.net/wx/jssdk/config',
                dataType: 'JSON',
                success: function(result) {
                    wx.config({
                        debug: false, 					// 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
                        appId: result.appid, 			// 必填，公众号的唯一标识
                        timestamp: result.timestamp, 	// 必填，生成签名的时间戳
                        nonceStr: result.noncestr, 		// 必填，生成签名的随机串
                        signature: result.signature,	// 必填，签名，见附录1
                        // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
                        jsApiList: [
                            'scanQRCode',
                            'chooseWXPay',
                        ]
                    });

                    wx.ready(function(){
                        console.log('权限验证成功')

                        $('#generatorQrCode').click(function() {
                            window.location.href = 'qr_code.html'
                        })

                        $('#share').click(function() {
                            window.location.href = 'share.html'
                        })
                        $('#oauth').click(function() {
                            window.location.href = 'oauth.html'
                        })
                        $('#pic').click(function() {
                            window.location.href = 'pic_sysphoto.html'
                        })

                    });

                    wx.error(function(res){
                        console.info(res);
                    });

                },
                error: function(e, ee) {
                    console.info(e);
                }
            })
        });
    </script>



    <br>
    <a href="javascript:window.location.reload();" class="weui-btn weui-btn_primary">刷新</a>
    <a href="javascript:;" id="generatorQrCode" class="weui-btn weui-btn_primary">生成二维码</a>
    <a href="javascript:;" id="share" class="weui-btn weui-btn_primary">分享</a>
    <a href="javascript:;" id="oauth" class="weui-btn weui-btn_primary">网页授权</a>
    <a href="javascript:;" id="pic" class="weui-btn weui-btn_primary">相机</a>

</body>
</html>